package com.xin.di.uav.applet.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xin.di.uav.applet.mapper.FeedbackTypeMapper;
import com.xin.di.uav.applet.po.FeedbackType;
import com.xin.di.uav.applet.service.IFeedbackTypeService;
import com.xin.di.uav.common.response.IdResponse;
import com.xin.di.uav.common.utils.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 反馈类型 服务实现类
 * </p>
 *
 * @author LTQ
 * @since 2023-06-08
 */
@Service
public class FeedbackTypeServiceImpl extends ServiceImpl<FeedbackTypeMapper, FeedbackType> implements IFeedbackTypeService {

    @Autowired
    private FeedbackTypeMapper feedbackTypeMapper;

    @Override
    public List<IdResponse> getAll() {
        QueryWrapper<FeedbackType> feedbackTypeQueryWrapper = new QueryWrapper<>();
        feedbackTypeQueryWrapper.eq("enable", true);
        feedbackTypeQueryWrapper.orderByAsc("display_order");
        List<FeedbackType> feedbackTypeList = feedbackTypeMapper.selectList(feedbackTypeQueryWrapper);
        List<IdResponse> idResponses = BeanUtil.copyProperties(feedbackTypeList, IdResponse.class);
        return idResponses;
    }
}
